package com.tu.mpi.helloworld;

import processing.core.PApplet;

public class HelloWorld extends PApplet{

	private static final long serialVersionUID = 1L;

	public void setup(){
		frame.setTitle("Hello World!");
		size(300, 150);
		background(0);
	}
	
	public void draw(){
		stroke(255);
		drawChar(10, 10, 'H');
		drawChar(70,10, 'E');
		drawChar(110, 10, 'L');
		drawChar(150, 10, 'L');
		drawChar(190, 10, 'O');
		drawChar(10,70, 'W');
		drawChar(70, 70, 'O');
		drawChar(130, 70, 'R');
		drawChar(180, 70, 'L');
		drawChar(220, 70, 'D');
		drawChar(270, 70, '!');
	}
	
	private void drawChar(int x, int y, char currentChar){
			switch (currentChar){
				case 'H':
					rect(x, y, 10, 50);
					rect(x+10, y+20, 30, 10);
					rect(x+40, y, 10, 50);
					break;
				case 'E':
					rect(x, y, 10, 50);
					rect(x+10, y, 20, 10);
					rect(x+10, y+20, 20, 10);
					rect(x+10, y+40, 20, 10);
					break;
				case 'L':
					rect(x, y, 10, 50);
					rect(x, y+40, 30, 10);
					break;
				case 'O':
					ellipseMode(CORNER);
					ellipse(x, y, 50, 50);
					stroke(0);
					fill(0);
					ellipse(x+10, y+10, 30, 30);
					stroke(255);
					fill(255);
					break;
				case 'W':
					rect(x,y,10,40);
					rect(x+10, y+40, 10, 10);
					rect(x+30, y+40, 10, 10);
					rect(x+20, y+30, 10, 10);
					rect(x+40, y, 10, 40);
					break;
//					pushMatrix();
//					rotateX(radians(61));
//					rect(x,y, 10,50);
//					popMatrix();
//					pushMatrix();
//					rotate(radians(45));
//					rect(x+20,y+25, 10, 20);
//					popMatrix();
//					pushMatrix();
//					rotate(radians(45));
//					rect(x+20,y+19, 20, 10);
//					popMatrix();
//					pushMatrix();
//					rotate(radians(31));
//					rect(x+15,y+24, 10, 50);
//					popMatrix();
				case 'R':
					rect(x,y,10,50);
					rect(x+10, y, 20, 10);
					rect(x+30, y+10, 10, 10);
					rect(x+10, y+20, 20, 10);
					rect(x+30, y+30, 10, 20);
					break;
				case 'D':
					rect(x,y,10,50);
					rect(x+10,y,20,10);
					rect(x+30, y+10, 10,30);
					rect(x+10, y+40, 20,10);
					break;
				case '!':
					rect(x, y, 10, 30);
					rect(x, y+40, 10, 10);
				}
			}
		
	
	public static void main(String[] args) {
		PApplet.main(new String[]{"com.tu.mpi.helloworld.HelloWorld"});
	}

}
